package com.ddzh.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data //get/set方法
@TableName(value = "user")
@AllArgsConstructor //全参构造
@NoArgsConstructor //无参构造
public class User implements Serializable {

    @TableId(type= IdType.AUTO) //设置主键自增
    private Integer id;

    @TableField(value = "`username`") //解决字段名和属性名不匹配
    private String userName;

    @TableField(value = "`realname`")
    private String realName;

    private Integer age;

    private String sex;

    private String email;

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", userName='" + userName + '\'' +
                ", realName='" + realName + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}
